<%--
  Created by IntelliJ IDEA.
  User: Wangxuyang
  Date: 16/6/5
  Time: 下午8:09
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>My JSP 'user.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <style type="text/css">
        table{
            border: 1px solid;
            background-color: green;
        }

        a:link{
            color:blue;
            text-decoration:none;
        }
        a:active:{
            color:orange;
        }
        a:visited{
            color: red;
            text-decoration:none;
        }
        a:hover{
            color: green;
            text-decoration:underline;
        }
        td{
            width: 100px;
            height: 40px;
            border: 1px solid;
            text-align: center;
            line-height: 20px;
        }
    </style>

    <script type="text/javascript">
        function del(id)
        {
            window.location.href="/EPUG/user/delUser?id="+id;
        }

        function update(id)
        {
            window.location.href="/EPUG/user/getUserById?id="+id;
        }
    </script>
</head>

<body>
<center>
    <table>
        <tr><td colspan="3"><h2>用户管理</h2></td><td colspan="3"><a href="jsp/addUser.jsp">添加用户</a></td></tr>
        <tr>
            <td>id</td>
            <td>姓名</td>
            <td>地址</td>
            <td>性别</td>
            <td colspan="2">管理</td>
        </tr>
        <c:forEach items="${users}" var="u">
            <tr>
                <td>${u.id }</td>
                <td>${u.name }</td>
                <td><input type="button" value="删除" onclick="del(${u.id})"/></td>
                <td><input type="button" value="修改" onclick="update(${u.id})"/></td>
            </tr>
        </c:forEach>
    </table>
</center>
</body>
</html>

